import java.io.File;
import java.io.IOException;

/**
 * Created by abely on 16-2-18.
 */
public class FileUtil {
    public static void CreateFile(String path){
        File file = new File(path);
        File filePath = new File(file.getParent());
        if(!filePath.exists()){
            CreateDir(filePath.getPath());
            try {
                file.createNewFile();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
    }
    public static void CreateFile(File filePath, String fileName){
        File file = new File(filePath,fileName);
        if(!filePath.exists()){
            filePath.mkdirs();
        }
        if(!file.exists()){
            try {
                file.createNewFile();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
    }
    public static void CreateFile(String filePath, String fileName){
        File file = new File(filePath);
        CreateFile(file,fileName);
    }
    public static void CreateDir(String path){
        File file = new File(path);
        if(!file.exists()){
            file.mkdirs();
        }
    }

}
